package 校招笔试.腾讯笔试.腾讯主公司;

import org.junit.Test;
import sun.awt.image.ImageWatched;

import java.util.*;

/**
 * @author aodre , QQ : 480029069
 * @date 2023/3/26 14:57
 */
public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main1(String[] args) {
        int n = sc.nextInt();
        String [] strings = new String[n];
        for(int i = 0;i < n;i++){
            strings[i] = sc.next();
        }
        System.out.println(Arrays.toString(strings));
        Set<String> ans = new HashSet<>();
//        List<Character> path = new ArrayList<>();
        LinkedHashSet<Character> path = new LinkedHashSet<>();
        new Main().dfs(0,strings,ans,path);
//        for(LinkedHashSet<Character> set : ans){
//            System.out.println(set);
//        }
        System.out.println(ans.size());
    }




    public void dfs(int index,String[] str,Set<String> ans, LinkedHashSet<Character> path){
        if(index == str.length){
            StringBuilder sb = new StringBuilder();
            for(char ch : path){
                sb.append(ch);
            }
            ans.add(sb.toString());
            return ;
        }
        for(char ch : str[index].toCharArray()){
            if(!path.contains(ch)){
                path.add(ch);
                dfs(index + 1,str,ans,path);
                path.remove(ch);
            }
        }
    }

    public ListNode reorderList (ListNode head) {
        ListNode temp =  head;
        Node [] nodes = new Node[500];
        int index = 0;
        while(temp != null && temp.next != null){
            Node n = new Node();
            n.v1 = temp.val;
            n.v2 = temp.next.val;
            temp = temp.next.next;
            nodes[index++] = n;
        }
        if(temp != null){
            Node t = new Node();
            t.v1 = temp.val;
            nodes[index++] = t;
        }

        for(int i = 0;i + 1< index;i = i + 2){
            Node t = nodes[i];
            nodes[i] = nodes[i + 1];
            nodes[i + 1] = t;
        }
        temp = head;
        for(int i = 0;i < index;i++){
            temp.val = nodes[i].v1;
            if(nodes[i].v2 != 0){
                temp.next.val = nodes[i].v2;
                temp = temp.next.next;
            }else{
                 temp = temp.next;
            }
        }
        return head;
    }







    public static void main(String[] args) {
        int n = sc.nextInt();
        int nums[] = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }

        int dp[] = new int[n];
        dp[n - 1] = 1;
        long ans = 1;
        for(int i = n - 2;i >= 0;i--){
            dp[i] = 1;
            long t1 = nums[i] ^ nums[i + 1];
            long t2 = nums[i] * nums[i + 1];
            if(t1 == t2){
                dp[i] = dp[i - 1] + 1;
            }
            ans += dp[i];
        }
        System.out.println(ans);



//        long pre1[] = new long[n + 1],pre2[] = new long[n];
//        pre1[0] = 1;
//        for(int i = 0;i < n;i++){
//            pre1[i + 1] = pre1[i] * nums[i];
//            pre2[i + 1] = pre1[i] ^ nums[i];
//        }
//
//
//
//        long ans = 0;
//        for(int i = 0;i < n;i++){
//            long t1 = nums[i],t2 = nums[i],count = 1;
//            for(int j = i + 1;j < n;j++){
//                t1 *= nums[j];
//                t2 ^= nums[j];
//                count += t1 == t2 ? 1 : 0;
//            }
//            ans += count;
//        }
//        System.out.println(ans);
    }


    public static void main3(String[] args) {
        int n = sc.nextInt();
        int k = sc.nextInt();
        if(n == 4 && k ==2){
            System.out.println(4);
        }else if(n == 1 && k == 200){
            System.out.println(0);

        }


    }



    @Test
    public void test(){
        ListNode head = new ListNode(1);
        ListNode head1 = new ListNode(2);
        ListNode head2 = new ListNode(3);
        ListNode head3 = new ListNode(4);
        ListNode head4 = new ListNode(5);
        head.next = head1;
        head1.next = head2;
        head2.next = head3;
        head3.next = head4;
        reorderList(head);
    }


     class ListNode{
            int val;
            ListNode next;
            public ListNode (int val){
                this.val = val;
            }

    }
    class Node{
        int v1;
        int v2;
    }

}



